]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
introspect: Fix whitelist check
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 25 Nov 2019 18:44:10 +0000 (19:44 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 25 Nov 2019 19:00:10 +0000 (20:00 +0100)
The whitelist is a list of well-known D-Bus names, which we then search
for the unique name we get from the method invocation - unsuccesfully.

Fix this by watching the bus for any name in the whitelist in order
to maintain a map from wel-known to unique name that we can use for
matching.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1916

js/misc/introspect.js

index a4c4b080062c27cd3ba112f7963fbcfaf89d897b..d12aac69de9b84649ebc84765d8bb98c020835d4 100644 (file)
@@ -40,6 +40,15 @@ var IntrospectService = class {
                         });
 
         this._syncRunningApplications();
+
+        this._whitelistMap = new Map();
+        APP_WHITELIST.forEach(appName => {
+            Gio.DBus.watch_name(Gio.BusType.SESSION,
+                appName,
+                Gio.BusNameWatcherFlags.NONE,
+                (conn, name, owner) => this._whitelistMap.set(name, owner),
+                (conn, name) => this._whitelistMap.delete(name));
+        });
     }
 
     _isStandaloneApp(app) {
@@ -51,7 +60,7 @@ var IntrospectService = class {
     }
 
     _isSenderWhitelisted(sender) {
-        return APP_WHITELIST.includes(sender);
+        return [...this._whitelistMap.values()].includes(sender);
     }
 
     _getSandboxedAppId(app) {